package main

import (
	"github.com/gin-gonic/gin"
	"github.com/spf13/viper"
	"go-barrage/common"
	"go-barrage/db"
	"go-barrage/handler"
	"log"
)

func init() {
	common.InitConfig()
	db.InitMySql()
	db.InitRedis()
	log.Println("-----------------所有配置初始化完毕-----------------")
}

func main() {

	gin.SetMode(gin.ReleaseMode)
	r := gin.Default()
	r.Use(handler.GinCrossHandler())
	r = CollectRoute(r)

	serverPort := viper.GetString("server.port")
	_ = r.Run(":" + serverPort)

}
